package com.qindian;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

/**
 * Author: Li
 * Date: 2018/5/7 0007
 * Description:
 */


public class TestRelativeLayout extends RelativeLayout {
    private Paint mPaint;
    private Path mPath;
    public TestRelativeLayout(Context context) {
        this(context,null);
    }

    public TestRelativeLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        initPaint();
    }

    private void initPaint() {
        mPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setColor(Color.RED);
        mPaint.setStyle(Paint.Style.FILL);

        mPath=new Path();
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
//        canvas.translate(getWidth()/2,getHeight()/2);
//        canvas.drawCircle(getWidth()/2,getHeight()/2,getHeight()/2,mPaint);
        super.dispatchDraw(canvas);

//        mPath.reset();
//        mPath.moveTo(0,0);
//        mPath.lineTo(100,0);
//        mPath.addArc(100,-50,150,50,90,90);
//        mPath.moveTo(150,50);
//        mPath.lineTo(150,200);
//        canvas.drawPath(mPath,mPaint);
    }
}
